import request from "@/utils/request";

// 加入购物车(修改商品数量)
export const reqAddToCart = (skuId, skuNum) => {
  return request({
    method: "POST",
    url: `/cart/addToCart/${skuId}/${skuNum}`,
  });
};

// 获取购物车列表
export const reqGetCartList = () => {
  return request({
    url: `/cart/cartList`,
  });
};

// 单选
export const reqUpdateCartIsChecked = (skuId, isChecked) => {
  return request({
    url: `/cart/checkCart/${skuId}/${isChecked}`,
  });
};

// 单个删除
export const reqDelCart = (skuId) => {
  return request({
    method: "DELETE",
    url: `/cart/deleteCart/${skuId}`,
  });
};

// 全选/全不选
export const reqUpdateAllCartIsChecked = (skuIdList, isChecked) => {
  return request({
    method: "POST",
    url: `/cart/batchCheckCart/${isChecked}`,
    data: skuIdList,
  });
};

// 批量删除
export const reqDelAllCart = (skuIdList) => {
  return request({
    method: "POST",
    url: `/cart/batchDeleteCart`,
    data: skuIdList,
  });
};
